+Wed Mar 20 22:59:23 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtkrbtree.[ch]: add _gtk_rbtree_set_fixed_height()
+
+ * gtk/gtktreeprivate.h: add fixed_height_check field
+
+ * gtk/gtktreeview.c (gtk_tree_view_init): initialize
+ scroll_sync_timer and fixed_height_check
+ (do_validate_rows): add fixed_height_check. If all validated rows
+ in the first cycle have the same height, then we set that height for
+ the entire tree. This is some sort of 'fake' optimization, but helps
+ a lot for the common case. We keep validating the entire tree in
+ the background though.
+ (gtk_tree_view_set_model): reset fixed_height_check
+
Wed Mar 20 16:36:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/*.c: Patch from Erwann Chenede, #73900 fixing
+Wed Mar 20 22:59:23 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtkrbtree.[ch]: add _gtk_rbtree_set_fixed_height()
+
+ * gtk/gtktreeprivate.h: add fixed_height_check field
+
+ * gtk/gtktreeview.c (gtk_tree_view_init): initialize
+ scroll_sync_timer and fixed_height_check
+ (do_validate_rows): add fixed_height_check. If all validated rows
+ in the first cycle have the same height, then we set that height for
+ the entire tree. This is some sort of 'fake' optimization, but helps
+ a lot for the common case. We keep validating the entire tree in
+ the background though.
+ (gtk_tree_view_set_model): reset fixed_height_check
+
Wed Mar 20 16:36:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/*.c: Patch from Erwann Chenede, #73900 fixing
+Wed Mar 20 22:59:23 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtkrbtree.[ch]: add _gtk_rbtree_set_fixed_height()
+
+ * gtk/gtktreeprivate.h: add fixed_height_check field
+
+ * gtk/gtktreeview.c (gtk_tree_view_init): initialize
+ scroll_sync_timer and fixed_height_check
+ (do_validate_rows): add fixed_height_check. If all validated rows
+ in the first cycle have the same height, then we set that height for
+ the entire tree. This is some sort of 'fake' optimization, but helps
+ a lot for the common case. We keep validating the entire tree in
+ the background though.
+ (gtk_tree_view_set_model): reset fixed_height_check
+
Wed Mar 20 16:36:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/*.c: Patch from Erwann Chenede, #73900 fixing
+Wed Mar 20 22:59:23 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtkrbtree.[ch]: add _gtk_rbtree_set_fixed_height()
+
+ * gtk/gtktreeprivate.h: add fixed_height_check field
+
+ * gtk/gtktreeview.c (gtk_tree_view_init): initialize
+ scroll_sync_timer and fixed_height_check
+ (do_validate_rows): add fixed_height_check. If all validated rows
+ in the first cycle have the same height, then we set that height for
+ the entire tree. This is some sort of 'fake' optimization, but helps
+ a lot for the common case. We keep validating the entire tree in
+ the background though.
+ (gtk_tree_view_set_model): reset fixed_height_check
+
Wed Mar 20 16:36:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/*.c: Patch from Erwann Chenede, #73900 fixing
+Wed Mar 20 22:59:23 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtkrbtree.[ch]: add _gtk_rbtree_set_fixed_height()
+
+ * gtk/gtktreeprivate.h: add fixed_height_check field
+
+ * gtk/gtktreeview.c (gtk_tree_view_init): initialize
+ scroll_sync_timer and fixed_height_check
+ (do_validate_rows): add fixed_height_check. If all validated rows
+ in the first cycle have the same height, then we set that height for
+ the entire tree. This is some sort of 'fake' optimization, but helps
+ a lot for the common case. We keep validating the entire tree in
+ the background though.
+ (gtk_tree_view_set_model): reset fixed_height_check
+
Wed Mar 20 16:36:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/*.c: Patch from Erwann Chenede, #73900 fixing
+Wed Mar 20 22:59:23 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtkrbtree.[ch]: add _gtk_rbtree_set_fixed_height()
+
+ * gtk/gtktreeprivate.h: add fixed_height_check field
+
+ * gtk/gtktreeview.c (gtk_tree_view_init): initialize
+ scroll_sync_timer and fixed_height_check
+ (do_validate_rows): add fixed_height_check. If all validated rows
+ in the first cycle have the same height, then we set that height for
+ the entire tree. This is some sort of 'fake' optimization, but helps
+ a lot for the common case. We keep validating the entire tree in
+ the background though.
+ (gtk_tree_view_set_model): reset fixed_height_check
+
Wed Mar 20 16:36:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/*.c: Patch from Erwann Chenede, #73900 fixing
while ((node = _gtk_rbtree_next (tree, node)) != NULL);
}
+void
+_gtk_rbtree_set_fixed_height (GtkRBTree *tree,
+ gint height)
+{
+ GtkRBNode *node;
+
+ if (tree == NULL)
+ return;
+
+ node = tree->root;
+ g_assert (node);
+
+ while (node->left != tree->nil)
+ node = node->left;
+
+ do
+ {
+ if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID))
+ _gtk_rbtree_node_set_height (tree, node, height);
+
+ if (node->children)
+ _gtk_rbtree_set_fixed_height (node->children, height);
+ }
+ while ((node = _gtk_rbtree_next (tree, node)) != NULL);
+}
+
typedef struct _GtkRBReorder
{
GtkRBTree *children;
GtkRBNode *node);
void _gtk_rbtree_column_invalid (GtkRBTree *tree);
void _gtk_rbtree_mark_invalid (GtkRBTree *tree);
+void _gtk_rbtree_set_fixed_height (GtkRBTree *tree,
+ gint height);
gint _gtk_rbtree_node_find_offset (GtkRBTree *tree,
GtkRBNode *node);
gint _gtk_rbtree_node_find_parity (GtkRBTree *tree,
gfloat scroll_to_col_align;
guint scroll_to_use_align : 1;
+ guint fixed_height_check : 1;
+
guint reorderable : 1;
guint header_has_focus : 1;
guint drag_column_window_state : 3;
tree_view->priv->press_start_y = -1;
tree_view->priv->reorderable = FALSE;
tree_view->priv->presize_handler_timer = 0;
+ tree_view->priv->scroll_sync_timer = 0;
+ tree_view->priv->fixed_height_check = 0;
gtk_tree_view_set_adjustments (tree_view, NULL, NULL);
tree_view->priv->selection = _gtk_tree_selection_new_with_tree_view (tree_view);
tree_view->priv->enable_search = TRUE;
GtkTreePath *path = NULL;
GtkTreeIter iter;
gint i = 0;
+
+ gint prev_height = -1;
+ gboolean fixed_height = TRUE;
+
g_assert (tree_view);
if (tree_view->priv->tree == NULL)
}
do
{
-
if (! GTK_RBNODE_FLAG_SET (tree_view->priv->tree->root, GTK_RBNODE_DESCENDANTS_INVALID))
{
retval = FALSE;
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
}
validated_area = validate_row (tree_view, tree, node, &iter, path) | validated_area;
+
+ if (!tree_view->priv->fixed_height_check)
+ {
+ gint height;
+
+ height = MAX (GTK_RBNODE_GET_HEIGHT (node), tree_view->priv->expander_size);
+ if (prev_height < 0)
+ prev_height = height;
+ else if (prev_height != height)
+ fixed_height = FALSE;
+ }
+
i++;
}
while (i < GTK_TREE_VIEW_NUM_ROWS_PER_IDLE);
+
+ if (!tree_view->priv->fixed_height_check)
+ {
+ if (fixed_height)
+ _gtk_rbtree_set_fixed_height (tree_view->priv->tree, prev_height);
+
+ tree_view->priv->fixed_height_check = 1;
+ }
done:
if (gtk_tree_row_reference_valid (tree_view->priv->top_row))
g_object_unref (tree_view->priv->model);
tree_view->priv->search_column = -1;
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_IS_LIST);
+ tree_view->priv->fixed_height_check = 0;
}
tree_view->priv->model = model;